﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="reorderList.aspx.cs" Inherits="PeisongWeb.admin.reorderList" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register TagName="top" Src="controls/top.ascx" TagPrefix="uc1" %>
<%@ Register TagName="menu" Src="controls/menu.ascx" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>周价补单管理 - 想购网长期采购物流配送系统</title>
    <!--#include file="style.inc"-->

    <script type="text/javascript" src="../app_common/scripts/jquery-cn.js"></script>

    <script type="text/javascript">
        function resetSrh() {
            document.getElementById("txt_orderNo").value = "";
            document.getElementById("drp_Status").value = "";
            document.getElementById("ext_StartInputDt").value = "";
            document.getElementById("ext_EndInputDt").value = "";
        }
        function checkCountNum(obj) {
            if (obj.value != "" && obj.value != "0") {
                var flag = IsPriceNumeric(obj.value);
                if (!flag)
                    obj.value = "1";
            }
            else
                obj.value = "1";
        }
        function IsPriceNumeric(oNum) {
            var strP = /^\d+(\.\d)?$/;
            if (strP.test(oNum))
                return true;
            else
                return false;
        }

        $(function() {
            $('.proName').mouseover(function(event) {
                $("#div_showProImg").show();
                var x = event.pageX;
                var y = event.pageY;
                var productId = $(this).attr('productid');
                $("#div_showProImg").css({ left: x + "px", top: y + "px" });
                Coolite.AjaxMethods.orderList_getDetails(productId, {
                    success: function(result) {
                        $("#img_product").attr("src", result);
                    }
                })
            });
            $('.proName').mouseout(function() {
                $("#div_showProImg").hide();
            });
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="sm1" runat="server">
    </asp:ScriptManager>
    <ext:ScriptManager ID="ScriptManager1" runat="server" />
    <uc1:top ID="Top1" runat="server" />
    <uc2:menu ID="Menu1" runat="server" />
    <div id="admin-body">
        <h2 class="section-cms">
            周价补单管理
        </h2>
        <span style="<%=power>=2?"": "display:none" %>">
            <ext:Button runat="server" ID="Button1" Icon="Add" Text="新增周价补单" OnClientClick="window.location.href='reorderEditV2.aspx'">
            </ext:Button>
        </span>
        <p>
            &nbsp;</p>
        <ext:Panel ID="Panel1" runat="server" Title="订单搜索" BodyStyle="padding:5px 5px 0"
            Width="960" Frame="true" ButtonAlign="Center">
            <Body>
                <ext:Panel ID="Panel5" runat="server">
                    <Body>
                        <ext:ColumnLayout ID="ColumnLayout2" runat="server">
                            <ext:LayoutColumn ColumnWidth=".5">
                                <ext:Panel ID="Panel6" runat="server" Border="false" Header="false">
                                    <Body>
                                        <div id="admin_edit_content_search">
                                            <ul>
                                                <li style="width: auto; margin-right: 20px">
                                                    <label>
                                                        订单编号
                                                    </label>
                                                    <asp:TextBox runat="server" ID="txt_orderNo" Width="80px"></asp:TextBox>
                                                </li>
                                                <li style="width: auto">
                                                    <label>
                                                        订单日期</label>
                                                    <ext:DateField ID="ext_StartInputDt" runat="server" AllowBlank="true" ReadOnly="true"
                                                        Width="100" />
                                                </li>
                                                <li style="width: auto">
                                                    <label style="width: 25px">
                                                        至
                                                    </label>
                                                    <ext:DateField ID="ext_EndInputDt" ReadOnly="true" runat="server" Width="100" />
                                                </li>
                                                <li style="width: auto">
                                                    <label>
                                                        &nbsp;
                                                    </label>
                                                    [<asp:LinkButton ID="lbtn_Search" runat="server" Text="搜 索" OnClick="lbtn_Search_Click"
                                                        CausesValidation="false">
                                                    </asp:LinkButton>]&nbsp;&nbsp;&nbsp; [<a href="javascript:resetSrh();">重 置</a>]
                                                </li>
                                            </ul>
                                        </div>
                                    </Body>
                                </ext:Panel>
                            </ext:LayoutColumn>
                        </ext:ColumnLayout>
                    </Body>
                </ext:Panel>
            </Body>
        </ext:Panel>
        <p>
            &nbsp;</p>
        <div id="admin_list_content" style="width: 960px">
            <table cellpadding="0" cellspacing="0">
                <tr class="header-row">
                    <th>
                        订单编号
                    </th>
                    <th>
                        订单来源
                    </th>
                    <th>
                        支付总价
                    </th>
                    <th>
                        采购商
                    </th>
                    <th>
                        下单日期
                    </th>
                    <th>
                        收货日期
                    </th>
                    <th>
                        订单状态
                    </th>
                    <th>
                        操作员
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
                <asp:Repeater ID="rpt_list" runat="server" OnItemCommand="rpt_list_ItemCommand">
                    <ItemTemplate>
                        <tr class='<%# Container.ItemIndex%2==0? "row-alt":"alt"  %>'>
                            <td style="width: 10%" height="26" align="center">
                                <%# Eval("orderno")%>
                            </td>
                            <td width="8%" height="26" align="center">
                                <%# String.Format("{0:F2}", Eval("sourceName")).ToString()%>
                            </td>
                            <td width="8%" height="26"'" align="center">
                                <%# String.Format("{0:F2}", Eval("amount")).ToString()%>
                            </td>
                            <td width="8%" height="26" align="center">
                                <%# Eval("company")%>
                            </td>
                            <td width="15%" height="26" align="center">
                                <%# Eval("orderDt")%>
                            </td>
                            <td width="15%" height="26" align="center">
                                <%# Eval("receiveDt")%>
                            </td>
                            <td width="10%" height="26" align="center">
                                <%# Eval("statusName")%>
                            </td>
                            <td width="8%" height="26" align="center">
                                <%#Eval("adminName")%>
                            </td>
                            <td width="8%" height="26" align="center">
                                <asp:LinkButton CausesValidation="false" ID="lbn_details" runat="server" CommandName="details"
                                    CommandArgument='<%# Eval("orderid") %>' Text="查看详情">
                                </asp:LinkButton>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </table>
            <div id="page">
                <webdiyer:AspNetPager ID="AspNetPager1" NumericButtonType="Text" MoreButtonType="Text"
                    OnPageChanged="AspNetPager1_PageChanged" runat="server" AlwaysShow="True" PageSize="20"
                    InvalidPageIndexErrorMessage="无效页码" PageIndexOutOfRangeErrorMessage="页码超出范围"
                    ShowCustomInfoSection="Left" CustomInfoHTML=" 每页%PageSize%条记录 | 总共%RecordCount%条记录 "
                    CustomInfoTextAlign="Left" HorizontalAlign="Right" NextPageText="下一页" FirstPageText="首页"
                    LastPageText="末页" PrevPageText="上一页">
                </webdiyer:AspNetPager>
            </div>
        </div>
        <ext:Window ID="order_details" runat="server" Title="订单详情" Height="550px" Width="920px"
            BodyStyle="padding: 6px; background-color: #fff;" AutoScroll="true" Modal="True"
            Resizable="false" ShowOnLoad="false" Draggable="false" Icon="ApplicationViewDetail">
            <Body>
                <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
                    <Triggers>
                        <asp:PostBackTrigger ControlID="lbn_Add" />
                        <asp:PostBackTrigger ControlID="rpt_OrderItems" />
                    </Triggers>
                    <ContentTemplate>
                        <div class="details">
                            <h2>
                                <asp:Label runat="server" ID="lbl_OrderNo"></asp:Label>
                            </h2>
                            <hr />
                            <ul>
                                <li>
                                    <label>
                                        订单来源：</label>
                                    <asp:Label runat="server" ID="lbl_orderSource"></asp:Label>
                                </li>
                                <li>
                                    <label>
                                        订单状态：</label>
                                    <asp:DropDownList runat="server" ID="ddl_Status" DataTextField="name" DataValueField="xm">
                                    </asp:DropDownList></li>
                                <li>
                                    <label runat="server" id="lbl_user">
                                    </label>
                                    <asp:Label runat="server" ID="lbl_username"></asp:Label>
                                </li>
                                <li>
                                    <label>
                                        下单日期：</label>
                                    <asp:Label runat="server" ID="lbl_orderDt"></asp:Label>
                                </li>
                                <li>
                                    <label>
                                        汇总总价：</label>
                                    <asp:Label runat="server" ID="lbl_StandardAmount"></asp:Label>
                                </li>
                                <li>
                                    <label>
                                        支付总价：</label>
                                    <input runat="server" id="txt_Amount" name="" type="text" readonly="readonly" style="background-color: #f0f0f0" />
                                </li>
                                <li>
                                    <label>
                                        客户备注：</label>
                                    <asp:Label runat="server" ID="lbl_Note"></asp:Label>
                                </li>
                                <li>
                                    <label>
                                        收货时间：</label>
                                    <span style="float: left">
                                        <ext:DateField ID="ext_receiveDt" runat="server" AllowBlank="true" ReadOnly="true" />
                                    </span>
                                    <asp:DropDownList runat="server" ID="ddl_receiveTime" DataTextField="name" DataValueField="xm">
                                    </asp:DropDownList>
                                </li>
                                <li>
                                    <label>
                                        客服备注：</label>
                                    <asp:TextBox runat="server" ID="txt_serviceNote" Rows="3" Columns="20" TextMode="MultiLine"
                                        MaxLength="500"></asp:TextBox>
                                </li>
                                <li>
                                    <label>
                                        交易关闭原因：</label>
                                    <asp:TextBox runat="server" ID="txt_closeReason" Rows="3" Columns="20" TextMode="MultiLine"
                                        MaxLength="500"></asp:TextBox>
                                    <input id="hd_orderid" runat="server" type="hidden" />
                                    <input id="hd_customerid" runat="server" type="hidden" />
                                    <input id="hd_companyid" runat="server" type="hidden" />
                                </li>
                            </ul>
                            <p>
                                &nbsp;</p>
                            <table width="98%" border="0" cellpadding="4" cellspacing="1" style="text-align: left">
                                <tr>
                                    <td>
                                        <h2>
                                            商品信息
                                        </h2>
                                        <hr />
                                    </td>
                                </tr>
                            </table>
                            <table width="98%" border="0" cellpadding="4" cellspacing="1" bgcolor="#99BBE8" style="text-align: left">
                                <tr align="center" style="height: 20px;">
                                    <td width="5%" bgcolor="#C0D5F0">
                                        序号
                                    </td>
                                    <td width="15%" bgcolor="#C0D5F0">
                                        商品名称
                                    </td>
                                    <td width="10%" bgcolor="#C0D5F0">
                                        商品价格
                                    </td>
                                    <td width="8%" bgcolor="#C0D5F0">
                                        初始数量
                                    </td>
                                    <td width="10%" bgcolor="#C0D5F0">
                                        商品数量
                                    </td>
                                    <td width="30%" bgcolor="#C0D5F0">
                                        备注
                                    </td>
                                    <td width="10%" bgcolor="#C0D5F0">
                                        合计
                                    </td>
                                    <td width="12%" bgcolor="#C0D5F0" style="<%=power>=2?"": "display:none" %>">
                                        操作
                                    </td>
                                </tr>
                                <asp:Repeater runat="server" ID="rpt_OrderItems" OnItemCommand="rpt_OrderItems_ItemCommand">
                                    <ItemTemplate>
                                        <tr align="center" style="height: 20px;">
                                            <td bgcolor="#FFFFFF">
                                                <%# Container.ItemIndex+1%>
                                                <asp:HiddenField ID="hid_oiId" runat="server" Value='<%#Eval("oiid") %>' />
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <a class="proName" productid='<%#Eval("productId")%>' target="_blank" href="../user_productDetail_<%#Eval("productId")%>.html">
                                                    <%#Eval("proName")%></a>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                ￥<%#string.Format("{0:F2}", Eval("price"))%>/<%#Eval("unit") %>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <%#Eval("initQuantity") %>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <asp:TextBox ID="txtQuantity" Width="50px" onblur='checkCountNum(this);' onafterpaste='checkCountNum(this);'
                                                    runat="server" Text='<%# string.Format("{0:F1}",Eval("quantity"))%>'></asp:TextBox>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <asp:TextBox ID="txtCustomerNote" Width="200px" runat="server" Text='<%# Eval("note")%>'></asp:TextBox>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                ￥<%# string.Format("{0:F2}", Convert.ToDecimal(Eval("price")) * Convert.ToDecimal(Eval("quantity")))%>
                                                &nbsp;
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <asp:Label runat="server" ID="Label2" Visible='<%#Convert.ToInt32(Eval("isShowDeduct"))==1?false:true%>'>已扣款</asp:Label>
                                                <span style="<%=power>=2?"": "display:none" %>">
                                                    <asp:LinkButton ID="lbt_delete" runat="server" CommandName="Del" CommandArgument='<%# Eval("oiid") %>'
                                                        Text="删除" OnClientClick="javascript:return confirm('你确定执行此操作吗?')" CausesValidation="false"
                                                        Visible='<%#Convert.ToInt32(Eval("status"))==4||Convert.ToInt32(Eval("status"))==5?false:true%>'>
                                                    </asp:LinkButton>
                                                </span>
                                                <asp:Label runat="server" ID="lbl_status" Visible='<%#Convert.ToInt32(Eval("status"))!=4?false:true%>'>交易成功</asp:Label>
                                                <asp:Label runat="server" ID="Label1" Visible='<%#Convert.ToInt32(Eval("status"))!=5?false:true%>'>交易关闭</asp:Label>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                                <tr align="center" style="height: 20px;">
                                    <td bgcolor="#C0D5F0" colspan="6">
                                        合&nbsp;&nbsp;计
                                    </td>
                                    <td bgcolor="#FFFFFF" align="right">
                                        ￥<asp:Label runat="server" CssClass="red" ID="lbl_Total"></asp:Label>
                                        &nbsp;
                                    </td>
                                    <td bgcolor="#FFFFFF">
                                        <span style="<%=power>=2?"": "display:none" %>">
                                            <asp:LinkButton ID="lbn_Add" runat="server" Text="添加商品" OnClick="lbn_Add_Click" CausesValidation="false">
                                            </asp:LinkButton>
                                        </span>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <h2>
                                收货信息</h2>
                            <hr />
                            <ul>
                                <li>
                                    <label>
                                        公司名称：</label>
                                    <asp:Label runat="server" ID="lbl_company"></asp:Label>
                                </li>
                                <li style="width: 500px">
                                    <label>
                                        收货人姓名：</label>
                                    <asp:Label runat="server" ID="lbl_contact"></asp:Label>
                                </li>
                                <li>
                                    <label>
                                        联系方式：</label>
                                    <asp:Label runat="server" ID="lbl_contactMobile"></asp:Label>
                                    <asp:Label runat="server" ID="lbl_contactPhone"></asp:Label>
                                </li>
                                <li class="long">
                                    <label>
                                        收货地址：
                                    </label>
                                    <asp:Label runat="server" ID="lbl_Address"></asp:Label>
                                </li>
                            </ul>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </Body>
        </ext:Window>
        <ext:Window ID="product_add" runat="server" Title="添加商品" Height="550px" Width="900px"
            BodyStyle="padding: 6px; background-color: #fff;" AutoScroll="true" Modal="True"
            Resizable="false" ShowOnLoad="false" Draggable="false" Icon="ApplicationViewDetail">
            <Body>
                <asp:UpdatePanel runat="server" ID="up1" UpdateMode="Conditional">
                    <Triggers>
                        <asp:PostBackTrigger ControlID="lbn_AddOrderItem" />
                    </Triggers>
                    <ContentTemplate>
                        <div class="details">
                            <table width="98%" border="0" cellpadding="4" cellspacing="1" style="text-align: left">
                                <tr>
                                    <td style="width: 18%">
                                        <label>
                                            大 类：</label>
                                        <asp:DropDownList runat="server" ID="ddl_CategoryRoot" DataTextField="name" DataValueField="categoryId"
                                            AutoPostBack="True" OnSelectedIndexChanged="ddl_CategoryRoot_SelectedIndexChanged">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="width: 18%">
                                        <label>
                                            小 类：</label>
                                        <asp:DropDownList runat="server" ID="ddl_CategorySub" DataTextField="name" DataValueField="categoryId">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="width: 18%">
                                        商品编号:<asp:TextBox ID="txt_ProductNo" runat="server" Width="80px"></asp:TextBox>
                                    </td>
                                    <td style="width: 18%">
                                        商品名称:<asp:TextBox ID="txt_ProductName" runat="server" Width="80px"></asp:TextBox>
                                    </td>
                                    <td style="width: 7%">
                                        <asp:LinkButton ID="lbn_search" runat="server" Text="［搜索］" CausesValidation="false"
                                            OnClick="lbn_search_Click">
                                        </asp:LinkButton>
                                    </td>
                                    <td align="right">
                                        <asp:LinkButton ID="lbn_AddOrderItem" runat="server" Text="［添加到订单］" CausesValidation="false"
                                            OnClick="lbn_AddOrderItem_Click">
                                        </asp:LinkButton>
                                        <asp:LinkButton ID="lbl_cancel" runat="server" Text="［取消］" CausesValidation="false"
                                            OnClick="lbl_cancel_Click">
                                        </asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                            <table id="tb_pro" width="98%" border="0" cellpadding="4" cellspacing="1" bgcolor="#99BBE8"
                                style="text-align: left">
                                <tr align="center" style="height: 20px;">
                                    <td width="6%" bgcolor="#C0D5F0">
                                        商品编号
                                    </td>
                                    <td width="25%" bgcolor="#C0D5F0">
                                        商品名称
                                    </td>
                                    <td width="15%" bgcolor="#C0D5F0">
                                        供应价
                                    </td>
                                    <td width="15%" bgcolor="#C0D5F0">
                                        购买价
                                    </td>
                                    <td width="10%" bgcolor="#C0D5F0">
                                        数量
                                    </td>
                                    <td width="23%" bgcolor="#C0D5F0">
                                        添加备注
                                    </td>
                                    <td width="12%" bgcolor="#C0D5F0">
                                        <input type="checkbox" name="”checkedAll”" id="checkedAll" onclick="selectAll(this)" />全选
                                    </td>
                                </tr>
                                <asp:Repeater runat="server" ID="rpt_Products">
                                    <ItemTemplate>
                                        <tr align="center" style="height: 20px;">
                                            <td bgcolor="#FFFFFF">
                                                <%# Eval("productNo")%>
                                                <asp:HiddenField ID="hid_productId" runat="server" Value='<%#Eval("productId") %>' />
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <a target="_blank" href="../user_productDetail_<%#Eval("productId")%>.html">
                                                    <asp:Label runat="server" ID="lbl_proName" Text='<%# Eval("Name")%>'></asp:Label>
                                                </a>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                ￥<asp:TextBox ID="txt_Price" onblur='IsPriceNumeric(this);' onafterpaste='checkCountNum2(this);'
                                                    Text="1" runat="server" Width="60px"></asp:TextBox>
                                                元/<asp:Label runat="server" ID="lbl_unit" Text='<%#Eval("unit")%>'></asp:Label>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                ￥<asp:TextBox ID="txt_BuyPrice" onblur='IsPriceNumeric(this);' onafterpaste='checkCountNum2(this);'
                                                    Text="1" runat="server" Width="60px"></asp:TextBox>
                                                元/<asp:Label runat="server" ID="Label1" Text='<%#Eval("unit")%>'></asp:Label>
                                            </td>
                                            <td bgcolor="#FFFFFF" align="center">
                                                <asp:TextBox ID="txtQuantity" onblur='checkCountNum(this);' onafterpaste='checkCountNum(this);'
                                                    runat="server" Text="1" MaxLength="8" Width="60px"></asp:TextBox>
                                            </td>
                                            <td bgcolor="#FFFFFF" align="center">
                                                <asp:TextBox ID="txtNote" runat="server" Width="150px" MaxLength="200"></asp:TextBox>
                                            </td>
                                            <td bgcolor="#FFFFFF" align="center">
                                                <asp:CheckBox ID="cbx_isSelect" runat="server" />
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </table>
                            <div>
                                <webdiyer:AspNetPager ID="AspNetPager2" NumericButtonType="Text" MoreButtonType="Text"
                                    runat="server" AlwaysShow="False" PageSize="20" InvalidPageIndexErrorMessage="无效页码"
                                    PageIndexOutOfRangeErrorMessage="页码超出范围" ShowCustomInfoSection="Left" CustomInfoHTML=" 每页%PageSize%条记录 | 总共%RecordCount%条记录 "
                                    CustomInfoTextAlign="Left" HorizontalAlign="Right" OnPageChanged="AspNetPager2_PageChanged"
                                    NextPageText="下一页" FirstPageText="首页" LastPageText="末页" PrevPageText="上一页">
                                </webdiyer:AspNetPager>
                            </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </Body>
        </ext:Window>
    </div>
    <div id="div_showProImg" style="display: none; background-color: #C0D5F0; width: auto;
        height: auto; z-index: 99999; position: absolute;">
        <img id="img_product" alt="" style="height: 150px; width: 200px; border: 1px solid #ddd;
            background-color: #FFF; margin: 5px;" src="" />
    </div>
    <input type="hidden" runat="server" id="hd_oiid" />
    </form>
</body>
</html>
